package com.bw.day0714.mapper;

import com.bw.bean.Student;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

public interface UserMapper {

    @Select("select * from student")
    public List<Map> findAll();

    @Select("select * from student where id = #{ids}")
    public Student findById(@Param("ids") Integer id);


    @Select("select\n" +
            "    toYYYYMMDD(stt) as dt,\n" +
            "    ch,\n" +
            "    count(*) uv\n" +
            "from gmall.dws_traffic_vc_ch_ar_is_new_page_view_window\n" +
            "where toYYYYMMDD(stt) = ${dt}\n" +
            "group by toYYYYMMDD(stt),ch")
    public List<Map> findTrafficUv(Integer dt);




    @Select("SELECT   " +
            "    uid,   " +
            "    argMax(gender, event_time) AS gender, " +
            "    argMax(age, event_time) AS age,      " +
            "    max(event_time) AS max_event_time     " +
            "FROM   " +
            "    gmall.user_baby_flink   " +
            "GROUP BY   " +
            "    uid   " +
            "order by uid;")
    public List<Map> findUb();


}
